
public class Test25 {
    public static void main(String[] args) {
        String str = "Hello World";
        String encoded = str.replace(" ", "%20");
        if (encoded != null) {
            System.out.println(encoded);
        }
    }
}